package com.good.msgsys.controller;

import com.good.msgsys.dto.PageResult;
import com.good.msgsys.dto.Result;
import com.good.msgsys.dto.ResultCode;
import com.good.msgsys.entity.response.AwardVo;
import com.good.msgsys.service.AwardService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author junlong
 * @date 2020/12/31 10:18
 */
@Api(tags = "成果模块")
@RestController
@RequestMapping("/api/award")
public class AwardController {
    @Autowired
    private AwardService awardService;

    // 查询所有成果
    @ApiOperation("查询所有成果")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "当前页码，从0开始", dataType = "Integer", required = true),
            @ApiImplicitParam(name = "limit", value = "每页条数", dataType = "Integer", defaultValue = "5")
    })
    @RequestMapping(value = "", method = RequestMethod.GET)
    public Result<PageResult<AwardVo>> findAll(@RequestParam("page") Integer page, @RequestParam(value = "limit", required = false, defaultValue = "5") Integer limit) {
        PageResult<AwardVo> awards = awardService.findAll(page, limit);
        return new Result<>(ResultCode.SUCCESS, awards);
    }
}
